package day240524.e1;

public class Test {
    public static void main(String[] args) {
        int[] counts = {10,100,1000,10000,100000,300000};
        for (int i = 0; i < counts.length; i++) {
            System.out.println("以下是 count = " + counts[i] + " 所需的时间");

            int finalI = i;
            TimeDo.getTime(() -> {
                String result = "";
                for (int j = 0; j < counts[finalI]; j++) {
                    result += j;
                }
            });

            int finalI1 = i;
            TimeDo.getTime(() -> {
                StringBuffer sb1 = new StringBuffer();
                for (int j = 0; j < counts[finalI1]; j++) {
                    sb1.append(j);
                }
            });

            int finalI2 = i;
            TimeDo.getTime(() -> {
                StringBuilder sb2 = new StringBuilder();
                for (int j = 0; j < counts[finalI2]; j++) {
                    sb2.append(j);
                }
            });

        }
    }

}
